package com.example.demo1.inquiry.dao;


import com.example.demo1.inquiry.model.InquiryParts;
import com.example.demo1.inquiry.model.InquirySupplier;
import com.example.demo1.inquiry.model.InquiryTotal;
import com.example.demo1.inquiry.model.vo.InquiryPartsVo;
import com.example.demo1.inquiry.model.vo.InquiryQueryVo;
import com.example.demo1.inquiry.model.vo.InquirySupplierVo;
import com.example.demo1.inquiry.model.vo.InquiryTotalVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Bean;

import java.util.List;
import java.util.function.Supplier;

/**
 * Created by Lx on 2018/6/29.
 */
@Mapper
public  interface InquiryMapper {

    List<InquiryParts> queryPartsByCodes(List<String> code);
    List<InquirySupplier> querySupplierByCodes(List<String> code);
    List<InquiryParts> queryPartsBySupplierCodes(List<String> code);
    List<InquiryParts> findByCode(Integer code);
      InquiryTotal findOne(Integer code);

    @Delete("delete from inquiryparts where inquiryId = #{id}")
    int deletePartsById(Integer id);
    @Delete("delete from inquiryparts where inquiryId = #{id}")
    int deleteSupplierById(Integer id);

    int saveInquiryParts(List <InquiryParts>  inquiryPartsList);
    int saveSupplier( List <InquirySupplier> inquirySupplierList);

    int saveInquiryTotal(InquiryTotal inquiryTotal);
    /**
     * 修改询价单主表信息
     * @param inquiryTotal
     * @return
     */
    int updateInquiry(InquiryTotal inquiryTotal);

    List<InquiryTotal> queryPage(InquiryQueryVo inquiryQueryVo);
    int queryCount(InquiryQueryVo inquiryQueryVo);

    @Select("select * from inquirytotal where id = #{id}")
    InquiryTotalVo seeInquiry(Integer id);

    @Select("select * from inquiryparts where inquiryId = #{id}")
    List<InquiryPartsVo> queryPartsByTotalId(Integer id);

    @Select("select * from inquirysupplier where inquiryId = #{id}")
    List<InquirySupplierVo> querySupplierByTotalId(Integer id);


}
